a11y: Use "presentation" role instead of "hidden" state
authorEmmanuele Bassi <ebassi@gnome.org>
Thu, 5 Nov 2020 13:19:26 +0000 (13:19 +0000)
committerEmmanuele Bassi <ebassi@gnome.org>
Thu, 5 Nov 2020 13:25:53 +0000 (13:25 +0000)
The intended use case of the "presentation" role is

| […] when an element is used to change the look of the page but does not
| have all the functional, interactive, or structural relevance implied
| by the element type, or may be used to provide for an accessible
| fallback in older browsers that do not support WAI-ARIA.

One of the examples is, literally:

| An element whose content is completely presentational (like a spacer
| image, decorative graphic, or clearing element);

Which fits perfectly for the GtkTreeExpander's "indent" builtin icon
widget.

gtk/gtktreeexpander.c

index 9ff4e6ac35bfab7e16720766adc0364989e64317..ec57b28ced3ffba3f0e23c3f154ce9f71b8bba54 100644 (file)
@@ -201,14 +201,13 @@ gtk_tree_expander_update_for_list_row (GtkTreeExpander *self)
             child = gtk_widget_get_prev_sibling (child);
           else
             {
-              GtkWidget *indent = gtk_builtin_icon_new ("indent");
+              GtkWidget *indent =
+                g_object_new (GTK_TYPE_BUILTIN_ICON,
+                              "css-name", "indent",
+                              "accessible-role", GTK_ACCESSIBLE_ROLE_PRESENTATION,
+                              NULL);
 
               gtk_widget_insert_after (indent, GTK_WIDGET (self), NULL);
-
-              /* The indent icon is not visible in the accessibility tree */
-              gtk_accessible_update_state (GTK_ACCESSIBLE (indent),
-                                           GTK_ACCESSIBLE_STATE_HIDDEN, TRUE,
-                                           -1);
             }
         }